module WsClient
	module Ietf00

		class Frame
			HEAD = "\x00"
			TAIL = "\xFF"
		
			attr_reader :message
		
			def initialize(message)
				# Raise exception if message is not utf-8 encoded?
				@message = message
			end
			
			def head
				HEAD
			end
			
			def tail
				TAIL
			end
			
			def length
				2 + @message.bytesize
			end
			
			def to_s
				[HEAD, @message.utf8, TAIL].join('')
			end
		end

	end
end
